package com.kun.portal.webframe.controller;
import com.kun.portal.webframe.po.GpConfigPo;
import com.kun.portal.webframe.service.GpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created by Administrator on 2018-09-05.
 * 机位配置控制器
 */
@Controller

@RequestMapping({"/api/sysSetting"})
public class GpController {
    @Autowired
    private GpService gpService;

    @RequestMapping(
            value = {"/findGp"},
            method = {RequestMethod.GET},
            produces = {"application/json"}
    )
    @ResponseBody
    public List<GpConfigPo> findAllGp(){
        return gpService.findAllGp();
    }
    @RequestMapping(
            value = {"/findAllGpWidthCurrentFlight"},
            method = {RequestMethod.GET},
            produces = {"application/json"}
    )
    @ResponseBody
    public List findAllGpWidthCurrentFlight(){
        return gpService.findAllGpWidthCurrentFlight();
    }

    @RequestMapping(
            value = {"/findAllGpWidthCurrentFlightAndGatePOD"},
            method = {RequestMethod.GET},
            produces = {"application/json"}
    )
    @ResponseBody
    public List findAllGpWidthCurrentFlightAndGatePOD(){
        return gpService.findAllGpWidthCurrentFlightAndGatePOD();
    }


    @RequestMapping(
            value = {"/saveGp"},
            method = {RequestMethod.POST},
            produces = {"application/json"}
    )
    @ResponseBody
    public void saveGp(@RequestBody GpConfigPo gpConfigPo){
        gpService.saveGp(gpConfigPo);
    }

    @RequestMapping(
            value = {"/delectGp"},
            method = {RequestMethod.POST},
            produces = {"application/json"}
    )
    @ResponseBody
    public void deleteGp(@RequestBody GpConfigPo gpConfigPo){
        gpService.deleteGp(gpConfigPo);
    }
/*获取未占用未分配的机位数据*/
    @RequestMapping(
            value = {"/findNoUseGp"},
            method = {RequestMethod.GET},
            produces = {"application/json"}
    )
    @ResponseBody
public List<GpConfigPo> findNoUseGp(){
        return gpService.findNoUseGp();

}/*通过id查找Gp*/
    @RequestMapping(
            value = {"/findGpById"},
            method = {RequestMethod.GET},
            produces = {"application/json"}
    )
    @ResponseBody
    public GpConfigPo findGpById(@RequestParam(required = false) String gpId){
        return gpService.findByOne(gpId);

    }




}
